package Models

import (
	"time"
)

/**
 * Created by Goland
 * User: wkk alisleepy@hotmail.com
 * Time: 2021/12/18 - 00:44
 * Desc: <管理员admin表模型>
 */

//gorm.DefaultTableNameHandler = func (db *gorm.DB, defaultTableName string) string {
//	return "prefix_" + defaultTableName
//}
//
//gorm.De

// Admin  定义admin模型，定义结构体
type Admin struct {
	ID        uint      `gorm:"primary_key" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	DeletedAt time.Time `json:"deleted_at"`
	Name      string    `gorm:"size:32;unique_index" json:"name"` // 设置唯一索引
	Password  string    `gorm:"size:64;not null" json:"password"`
	Status    string    `gorm:"size:32;default:启用;not null" json:"status"`
}

// TableName 设置表名：前缀 + 表名
//func (a *Admin) TableName() string {
//	return Database.MysqlConfig["prefix"] + "admin"
//}
